<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>9-navigator对象</title>
</head>
<body>
    <script>
        //console.log(navigator);
        console.log(navigator.userAgent);
        if(navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobil e|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|W indows Phone)/i)){
            console.log('mobile');
            //window.location.href = 'https://m.jd.com/';
        }else{
            console.log('pc');
            //window.location.href = 'https://www.jd.com/';
        }
        //pc端和移动端
        //pc端 https://www.jd.com/
        //移动端 https://m.jd.com/

    </script>
</body>
</html>